<template>
  <div style="width: 90%;margin-left: 5%;">

    <el-alert
      style="margin-top: 50px;"
      title="未审核"
      :closable="false"
      type="info"
      v-if="formData.examineStatus==0"
      show-icon
    >
    </el-alert>

    <el-alert
      style="margin-top: 50px;"
      title="审核已通过"
      :closable="false"
      type="success"
      description="你的信息已通过审核"
      v-if="formData.examineStatus==3"
      show-icon
    ></el-alert>

      <el-alert
        style="margin-top: 50px;"
        title="审核中"
        :closable="false"
        description="等待管理员审核，一般需要1-2天"
        type="info"
        v-if="formData.examineStatus==1"
        show-icon
      >
    </el-alert>

    <el-alert
      style="margin-top: 50px;"
      title="审核未通过"
      :closable="false"
      type="error"
      :description="'原因：'+errorMsg"
      v-if="formData.examineStatus==2"
      show-icon
    >
    </el-alert>
    <el-row :gutter="100" v-loading="loading" >
      <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px"
               label-position="top">
        <el-col>
          <el-divider content-position="center">基本信息</el-divider>
        </el-col>
        <el-col :sm="24" :lg="8" >
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="姓名" prop="stuName">
                <el-input v-model="formData.stuName" placeholder="请输入姓名" clearable :style="{width: '100%'}">
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
<!--        <el-col :sm="24" :lg="8">-->
<!--          <el-row :gutter="15">-->
<!--            <el-col :span="24">-->
<!--              <el-form-item label="学号" prop="stuSno">-->
<!--                <el-input v-model="formData.stuSno" placeholder="请输入学号" clearable :style="{width: '100%'}">-->
<!--                </el-input>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--          </el-row>-->
<!--        </el-col>-->
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="性别" prop="stuGender">
                <el-select v-model="formData.stuGender" placeholder="请输入性别" clearable
                           :style="{width: '100%'}">
                  <el-option v-for="(item, index) in stuGenderOptions" :key="index" :label="item.label"
                             :value="item.value" :disabled="item.disabled"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="考生号" prop="stuExamId">
                <el-input v-model="formData.stuExamId" placeholder="请输入考生号" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="证件号" prop="stuCardId">
                <el-input v-model="formData.stuCardId" placeholder="请输入证件号" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="出生日期" prop="stuBirth">
                <el-input v-model="formData.stuBirth" placeholder="格式：2021-05-21" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
<!--        <el-col :sm="24" :lg="8">-->
<!--          <el-row :gutter="15">-->
<!--            <el-col :span="24">-->
<!--              <el-form-item label="毕业年份" prop="stuGraduateDate">-->
<!--                <el-input v-model="formData.stuGraduateDate" placeholder="格式：2021" clearable-->
<!--                          :style="{width: '100%'}"></el-input>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--          </el-row>-->
<!--        </el-col>-->
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="户口所在地" prop="stuResidenceAddress">
                <el-input v-model="formData.stuResidenceAddress" placeholder="请输入户口所在地" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label-width="120px" label="学习工作单位" prop="stuWorkingCompany">
                <el-input v-model="formData.stuWorkingCompany" placeholder="请输入学习工作单位" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="移动电话" prop="stuMobile">
                <el-input v-model="formData.stuMobile" placeholder="请输入移动电话" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="邮箱" prop="stuEmail">
                <el-input v-model="formData.stuEmail" placeholder="请输入邮箱" clearable :style="{width: '100%'}">
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="毕业学校" prop="stuUgSchool">
                <el-input v-model="formData.stuUgSchool" placeholder="请输入毕业学校" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="毕业专业" prop="stuUgMajor">
                <el-input v-model="formData.stuUgMajor" placeholder="请输入毕业专业" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="毕业时间" prop="stuUgTime">
                <el-input v-model="formData.stuUgTime" placeholder="例：2020-09-01" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col>
          <el-divider content-position="center">报考信息</el-divider>
        </el-col>
        <el-col :span="24">
          <el-row :gutter="15">
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label-width="140px" label="专业学科" prop="stuPgFirstWishSchool">
                <el-select v-model="formData.subId" placeholder="专业学科" clearable filterable
                           :style="{width: '100%'}">
                  <el-option v-for="subject in subjectList" :label="subject.subName" :value="subject.id"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="考生来源类别" prop="stuSourceType">
                <el-input v-model="formData.stuSourceType" placeholder="考生来源类别" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label-width="140px" label="一志愿报考学校" prop="stuPgFirstWishSchool">
                <el-input v-model="formData.stuPgFirstWishSchool" placeholder="一志愿报考学校" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label-width="140px" label="一志愿报考专业" prop="stuPgFirstWishMajor">
                <el-input v-model="formData.stuPgFirstWishMajor" placeholder="一志愿报考专业" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label-width="150px" label="一志愿报考专业方向" prop="stuPgFirstWishDirection">
                <el-input v-model="formData.stuPgFirstWishDirection" placeholder="一志愿报考专业方向" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="外国语分数" prop="stuPgExamForeignScore">
                <el-input v-model="formData.stuPgExamForeignScore" placeholder="外国语分数" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label-width="120px" label="政治理论分数" prop="stuPgExamPolitical">
                <el-input v-model="formData.stuPgExamPolitical" placeholder="政治理论分数" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="数学分数" prop="stuPgExamMath">
                <el-input v-model="formData.stuPgExamMath" placeholder="数学分数" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="自命题分数" prop="stuPgExamSchool">
                <el-input v-model="formData.stuPgExamSchool" placeholder="自命题分数" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="初试总分" prop="stuPgExamTotal">
                <el-input v-model="formData.stuPgExamTotal" placeholder="初试总分" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="复试成绩" prop="stuPgReview">
                <el-input v-model="formData.stuPgReview" placeholder="复试成绩" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="总成绩" prop="stuPgTotal">
                <el-input v-model="formData.stuPgTotal" placeholder="总成绩" clearable :style="{width: '100%'}">
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="调剂专业" prop="stuPgSecondMajor">
                <el-input v-model="formData.stuPgSecondMajor" placeholder="调剂专业" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :sm="24" :lg="8">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label="调剂专业方向" prop="stuPgSecondDirection">
                <el-input v-model="formData.stuPgSecondDirection" placeholder="调剂专业方向" clearable
                          :style="{width: '100%'}"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>

        <el-col :span="24">
            <el-divider content-position="center">奖惩信息</el-divider>
        </el-col>
        <el-col :span="24">
          <el-form-item label-width="0" prop="stuResume">
            <editor :upload-url="uploadUrl" v-model="formData.stuReward" :height="300">

            </editor>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-divider content-position="center">简历信息</el-divider>
        </el-col>
        <el-col :span="24">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label-width="0" prop="stuResume">
                <editor :upload-url="uploadUrl" v-model="formData.stuResume" :height="300">

                </editor>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="24">
          <el-col>
            <el-divider content-position="center">支撑材料(成绩单，创新创业，发表论文等)</el-divider>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item label-width="0" prop="stuDependence">
                <editor :upload-url="uploadUrl" v-model="formData.stuDependence" :height="300">

                </editor>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>

        <el-col :span="24">
          <el-col>
            <el-divider content-position="center">家庭成员信息</el-divider>
          </el-col>
        </el-col>
        <el-col>
          <el-button icon="el-icon-plus" type="primary" @click="addMember" >添加家庭成员</el-button>
        </el-col>
        <div v-for="(member,index) in formData.members">
          <el-col>
            <el-divider content-position="center">{{index+1}}</el-divider>
          </el-col>
          <el-col>
            <el-button type="danger" icon="el-icon-minus" size="small" @click="delMember(index)">移除</el-button>
          </el-col>
          <el-col :sm="24" :lg="8">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="姓名" :prop="`members[${index}].name`" :rules="{ required: true, message: '请输入姓名', trigger: 'blur' }">
                  <el-input v-model="member.name" placeholder="请输入姓名"  clearable :style="{width: '100%'}">
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :sm="24" :lg="8">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="性别" :rules="{ required: true, message: '请输入性别', trigger: 'blur' }" :prop="`members[${index}].gender`">
                  <el-select v-model="member.gender" placeholder="请输入性别" clearable
                             :style="{width: '100%'}">
                    <el-option v-for="(item, index) in stuGenderOptions" :key="index" :label="item.label"
                               :value="item.value" :disabled="item.disabled"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :sm="24" :lg="8">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="联系电话" :rules="{ required: true, message: '请输入联系电话', trigger: 'blur' }" :prop="`members[${index}].phone`">
                  <el-input v-model="member.phone" placeholder="请输入联系电话" clearable :style="{width: '100%'}">
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :sm="24" :lg="8">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="与学生关系" :rules="{ required: true, message: '与学生关系', trigger: 'blur' }" :prop="`members[${index}].relation`">
                  <el-input v-model="member.relation" :style="{width: '100%'}" placeholder="与学生关系"></el-input>
<!--                  <el-select v-model="member.relation" placeholder="与学生关系" clearable :style="{width: '100%'}">-->
<!--                    <el-option v-for="(item, index) in relationOptions" :key="index" :label="item.label"-->
<!--                               :value="item.value" :disabled="item.disabled"></el-option>-->
<!--                  </el-select>-->
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :sm="24" :lg="8">
            <el-row :gutter="15">
              <el-col :span="24">
<!--                :rules="{ required: true, message: '民族', trigger: 'blur' }"-->
                <el-form-item label="民族"  :prop="`members[${index}].nation`">
                  <el-input v-model="member.nation" placeholder="民族" clearable :style="{width: '100%'}">
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>

          <el-col :sm="24" :lg="8">
            <el-row :gutter="36">
              <el-col :span="24">
<!--                :rules="{ required: true, message: '职业', trigger: 'blur' }"-->
                <el-form-item label="职业"  :prop="`members[${index}].address`">
                  <el-input v-model="member.profession" placeholder="职业" clearable :style="{width: '100%'}">
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>

          <el-col :sm="24" :lg="8">
            <el-row :gutter="36">
              <el-col :span="24">
<!--                :rules="{ required: true, message: '家庭地址', trigger: 'blur' }"-->
                <el-form-item label="家庭地址"  :prop="`members[${index}].address`">
                  <el-input v-model="member.address" placeholder="家庭地址" clearable :style="{width: '100%'}">
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>

        </div>

      </el-form>
    </el-row >
    <el-row justify="center" type="flex" >
        <el-button style="margin:40px" type="primary" @click="submitForm">提交审核</el-button>
        <el-button style="margin:40px" @click="previewVisible = true">预览</el-button>
        <el-button style="margin:40px" @click="resetForm">重置</el-button>
    </el-row>

    <el-dialog width="90%" title="预览信息" fullscreen :visible="previewVisible" @close="previewVisible = false">
      <student-info :stu-data="formData"></student-info>
    </el-dialog>
  </div>
</template>
<script>
  import {getStudentDetailInfo,addStudentInfo,getStudentDetailByUserId} from "@/api/mentor/student"
  import {getExamineMsg} from "@/api/mentor/examine"
  import {getInfo} from "@/api/login"
  import {getAllSubject} from "../../../api/mentor/subject";

  import editor from '../../../components/Editor'
  import studentInfo from '../../../components/StudentInfo'
  export default {
    components: {
      editor,
      studentInfo
    },
    props: [],
    data() {
      return {
        uploadUrl:process.env.VUE_APP_BASE_API+'/common/upload',
        formData: {
          subId:undefined,
          stuName: undefined,
          // stuSno: undefined,
          stuGender: undefined,
          stuExamId: undefined,
          stuCardId: undefined,
          stuBirth: undefined,
          stuGraduateDate: undefined,
          stuResidenceAddress: undefined,
          stuWorkingCompany: undefined,
          stuMobile: undefined,
          stuEmail: undefined,
          stuUgSchool: undefined,
          stuUgMajor: undefined,
          stuUgTime: undefined,
          stuPgFirstWishSchool: undefined,
          stuPgFirstWishMajor: undefined,
          stuPgFirstWishDirection: undefined,
          stuPgExamForeignScore: undefined,
          stuPgExamPolitical: undefined,
          stuPgExamMath: undefined,
          stuPgExamSchool: undefined,
          stuPgExamTotal: undefined,
          stuPgReview: undefined,
          stuPgTotal: undefined,
          stuPgSecondMajor: undefined,
          stuPgSecondDirection: undefined,
          stuSourceType: undefined,
          stuDependence: null,
          stuResume:undefined,
          stuReward:undefined,
          members:[]
        },
        rules: {
          stuName: [{
            required: true,
            message: '请输入姓名',
            trigger: 'blur'
          }],
          // stuSno: [{
          //   required: true,
          //   message: '请输入学号',
          //   trigger: 'blur'
          // }],
          stuGender: [{
            required: true,
            message: '请输入性别',
            trigger: 'change'
          }],
          stuCardId: [{
            required: true,
            message: '请输入证件号',
            trigger: 'blur'
          }],
          stuBirth: [{
            required: true,
            message: '格式：2021-05-21',
            trigger: 'blur'
          }],
          stuGraduateDate: [{
            required: true,
            message: '格式：2021',
            trigger: 'blur'
          }],
          stuResidenceAddress: [{
            required: true,
            message: '请输入户口所在地',
            trigger: 'blur'
          }],
          // stuWorkingCompany: [{
          //   required: true,
          //   message: '请输入学习工作单位',
          //   trigger: 'blur'
          // }],
          stuMobile: [{
            required: true,
            message: '请输入移动电话',
            trigger: 'blur'
          }],
          stuEmail: [{
            required: true,
            message: '请输入邮箱',
            trigger: 'blur'
          }],
          stuUgSchool: [{
            required: true,
            message: '请输入毕业学校',
            trigger: 'blur'
          }],
          stuUgMajor: [{
            required: true,
            message: '请输入毕业专业',
            trigger: 'blur'
          }],
          stuUgTime: [{
            required: true,
            message: '例：2020-9',
            trigger: 'blur'
          }],
          // stuPgFirstWishSchool: [{
          //   required: true,
          //   message: '一志愿报考学校',
          //   trigger: 'blur'
          // }],
          // stuPgFirstWishMajor: [{
          //   required: true,
          //   message: '一志愿报考专业',
          //   trigger: 'blur'
          // }],
          // stuPgFirstWishDirection: [{
          //   required: true,
          //   message: '一志愿报考专业方向',
          //   trigger: 'blur'
          // }],
          // stuPgExamForeignScore: [{
          //   required: true,
          //   message: '外国语分数',
          //   trigger: 'blur'
          // }],
          // stuPgExamPolitical: [{
          //   required: true,
          //   message: '政治理论分数',
          //   trigger: 'blur'
          // }],
          // stuPgExamMath: [{
          //   required: true,
          //   message: '数学分数',
          //   trigger: 'blur'
          // }],
          // stuPgExamSchool: [{
          //   required: true,
          //   message: '自命题分数',
          //   trigger: 'blur'
          // }],
          // stuPgExamTotal: [{
          //   required: true,
          //   message: '初试总分',
          //   trigger: 'blur'
          // }],
          // stuPgReview: [{
          //   required: true,
          //   message: '复试成绩',
          //   trigger: 'blur'
          // }],
          // stuPgTotal: [{
          //   required: true,
          //   message: '总成绩',
          //   trigger: 'blur'
          // }],
          subId: [{
            required: true,
            message: '专业学科',
            trigger: 'blur'
          }]
        },
        subjectList:[],
        stuDependenceAction: 'https://jsonplaceholder.typicode.com/posts/',
        stuDependencefileList: [],
        stuResumeAction: 'https://jsonplaceholder.typicode.com/posts/',
        stuResumefileList: [],
        stuGenderOptions: [{
          "label": "女",
          "value": 0
        }, {
          "label": "男",
          "value": 1
        }],
        relationOptions: [{
          "label": "父亲",
          "value": 0
        }, {
          "label": "母亲",
          "value": 1
        }, {
          "label": "兄弟",
          "value": 2
        }, {
          "label": "姐妹",
          "value": 3
        }],
        errorMsg:'',
        loading:false,
        previewVisible:false
      }
    },
    computed: {},
    watch: {},
    async created() {

      this.loading = true

      const res = await getInfo()
      const flag = this.checkUser(res.user);
      if (!flag) {
        this.$message.warning("本菜单只针对学生开放")
        await this.$router.push("/")
        return
      }

      this.formData.userId = parseInt(res.user.userId)
      this.userId = res.user.userId
      await this.checkUserInfo()
      await this.getAllSubject()
      //未通过审核，获取原因
      if (this.formData.examineStatus==2){
        await this.getExamineMsg()
      }

      this.loading = false
    },
    mounted() {},
    methods: {
      submitForm() {
        this.$refs['elForm'].validate(async valid => {
          if (!valid) return this.$message.warning("有必填项未填")
          // TODO 提交表单
          const res = await addStudentInfo(this.formData)
          // console.log(res)
          if (res.code!=200){
            return this.$message.error("提交审核失败")
          }
          this.$message.success("提交审核成功")
          await this.$router.go(0)
        })
      },
      resetForm() {
        this.$refs['elForm'].resetFields()
      },
      stuDependenceBeforeUpload(file) {
        let isRightSize = file.size / 1024 / 1024 < 1024
        if (!isRightSize) {
          this.$message.error('文件大小超过 1024MB')
        }
        let isAccept = new RegExp('.pdf').test(file.type)
        if (!isAccept) {
          this.$message.error('应该选择.pdf类型的文件')
        }
        return isRightSize && isAccept
      },
      async getStudentDetailInfo() {
        const res = await getStudentDetailInfo(this.studentId)
        this.formData = res.data
        // console.log(res)
      },
      addMember(){
        if (this.formData.members==null){
          this.formData.members = []
        }
        this.formData.members.push({name:''})
        // console.log(this.formData.members.length)
      },
      delMember(index){
        this.formData.members.splice(index,1)
      },
      async checkUserInfo() {
        const res = await getStudentDetailByUserId(this.userId)
        this.formData = res.data
        // console.log(res)
      },
      checkUser(user){
        // console.log(user)
        for (let i = 0; i < user.roles.length; i++) {
          if (user.roles[i].roleKey=='student'){
            return true
          }
        }
        return false
      },
      //获取学生的审核消息 1研究生 2导师
      async getExamineMsg(){
        const res = await getExamineMsg(1,this.formData.stuId)
        this.errorMsg = res.data.message
      },
      async getAllSubject() {
        const res = await getAllSubject()
        this.subjectList = res.data
      }
    }
  }

</script>
<style>
  .el-upload__tip {
    line-height: 1.2;
  }

</style>
